package hopital.orm;

import hopital.sql.SqlObject;
import java.sql.ResultSet;
import java.sql.SQLException;

public abstract class Utilisateur extends SqlObject{

    protected String _nom,_prenom,_email,_adresse,_telephone,_motDePass;

    public String getMotDePass() {
        return _motDePass;
    }

    public void setMotDePass(String _motDePass) {
        this._motDePass = _motDePass;
    }

    public Utilisateur() {
    }

    
    public Utilisateur(String _nom, String _prenom, String _email, String _adresse, String _telephone) {
        this._nom = _nom;
        this._prenom = _prenom;
        this._email = _email;
        this._adresse = _adresse;
        this._telephone = _telephone;
    }
    

    public Utilisateur(ResultSet _rs) throws SQLException {
        this(_rs.getString("c_nom"), _rs.getString("c_prenom"), 
                _rs.getString("c_email"), _rs.getString("c_adresse"),
                _rs.getString("c_telephone"));
        this._id=_rs.getInt("c_id");
        this._motDePass=_rs.getString("c_password");
    }

    public String getNom() {
        return _nom;
    }

    public void setNom(String _nom) {
        this._nom = _nom;
    }

    public String getPrenom() {
        return _prenom;
    }

    public void setPrenom(String _prenom) {
        this._prenom = _prenom;
    }

    public String getEmail() {
        return _email;
    }

    public void setEmail(String _email) {
        this._email = _email;
    }

    public String getAdresse() {
        return _adresse;
    }

    public void setAdresse(String _adresse) {
        this._adresse = _adresse;
    }

    public String getTelephone() {
        return _telephone;
    }

    public void setTelephone(String _telephone) {
        this._telephone = _telephone;
        if(_id==-1){
           this._motDePass=_telephone; 
        }
    }

    @Override
    public String toString() {
        return  _nom + " " + _prenom ;
    }
}
